﻿using System;
using System.Collections.Generic;
using System.Text;

namespace _2_Services.Services
{
    /// <summary>
    /// 公共工具类
    /// </summary>
    public static class Tool
    {
        /// <summary>
        /// 分页时计算页数
        /// </summary>
        /// <param name="totalCount">总记录数</param>
        /// <param name="pageSize">单页记录数</param>
        /// <returns></returns>
        public static int PageCount(int totalCount, int pageSize)
        {
            int totalPage;
            if (totalCount >= pageSize)
            {
                totalPage = totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1;
            }
            else
            {
                totalPage = 1;
            }
            return totalPage;
        }
    }
}
